﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;

/// <summary>
/// Summary description for email
/// </summary>
public class email
{
	public email()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    public void sendMail(string body, string from, string to, string cc, string subject)
    {
        string _body = body.ToString();
        //string delim = ";";
        SmtpClient MailObj = new SmtpClient("mail.avila.edu");
        MailMessage msg = new MailMessage();
        msg.From = new MailAddress(from.ToString());
        msg.To.Add(new MailAddress(to.ToString()));
        msg.CC.Add(new MailAddress(cc.ToString()));
        msg.Subject = subject.ToString();
        msg.Body = _body.ToString();
        msg.IsBodyHtml = true;
        MailObj.Send(msg);
    }

    public void sendEmail2(string body, string from, string to, string subject)
    {
        //string _body = body.ToString();
        // string delim = ";";
        MailMessage Msg = new MailMessage();
        string[] addresses = to.Split(new char[] { ';' });
        foreach (string recip in addresses)
        {
            Msg.To.Add(recip);
        }

        Msg.From = new MailAddress(from.ToString());
        Msg.Subject = subject.ToString();
        Msg.Body = body.ToString();
        Msg.IsBodyHtml = true;
        SmtpClient MailObj = new SmtpClient("mail.avila.edu", 25);
        MailObj.Send(Msg);
    }
}